package JUC;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author 豆包LU
 * @date 2023/5/23 11:52
 */
public class OrderedThreadExecution2 {
    public static void main(String[] args) {
        ExecutorService executor = Executors.newSingleThreadExecutor();

        executor.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("T1");
            }
        });

        executor.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("T2");
            }
        });

        executor.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("T3");
            }
        });

        // 关闭线程池
        executor.shutdown();
    }
}
